Integrand size = 38, antiderivative size = 107 \[ \int (a+b \cos (c+d x))^2 \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\frac {1}{2} \left (2 a^2 B+b^2 B+2 a b C\right ) x+\frac {2 \left (3 a b B+a^2 C+b^2 C\right ) \sin (c+d x)}{3 d}+\frac {b (3 b B+2 a C) \cos (c+d x) \sin (c+d x)}{6 d}+\frac {C (a+b \cos (c+d x))^2 \sin (c+d x)}{3 d} \]
1/2*(2*B*a^2+B*b^2+2*C*a*b)*x+2/3*(3*B*a*b+C*a^2+C*b^2)*sin(d*x+c)/d+1/6*b *(3*B*b+2*C*a)*cos(d*x+c)*sin(d*x+c)/d+1/3*C*(a+b*cos(d*x+c))^2*sin(d*x+c) /d
Time = 0.89 (sec) , antiderivative size = 90, normalized size of antiderivative = 0.84 \[ \int (a+b \cos (c+d x))^2 \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\frac {6 \left (2 a^2 B+b^2 B+2 a b C\right ) (c+d x)+3 \left (8 a b B+4 a^2 C+3 b^2 C\right ) \sin (c+d x)+3 b (b B+2 a C) \sin (2 (c+d x))+b^2 C \sin (3 (c+d x))}{12 d} \]
(6*(2*a^2*B + b^2*B + 2*a*b*C)*(c + d*x) + 3*(8*a*b*B + 4*a^2*C + 3*b^2*C) *Sin[c + d*x] + 3*b*(b*B + 2*a*C)*Sin[2*(c + d*x)] + b^2*C*Sin[3*(c + d*x) ])/(12*d)
Time = 0.47 (sec) , antiderivative size = 110, normalized size of antiderivative = 1.03, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {3042, 3508, 3042, 3232, 3042, 3213}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \sec (c+d x) (a+b \cos (c+d x))^2 \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {\left (a+b \sin \left (c+d x+\frac {\pi }{2}\right )\right )^2 \left (B \sin \left (c+d x+\frac {\pi }{2}\right )+C \sin \left (c+d x+\frac {\pi }{2}\right )^2\right )}{\sin \left (c+d x+\frac {\pi }{2}\right )}dx\) |
\(\Big \downarrow \) 3508 |
\(\displaystyle \int (a+b \cos (c+d x))^2 (B+C \cos (c+d x))dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \left (a+b \sin \left (c+d x+\frac {\pi }{2}\right )\right )^2 \left (B+C \sin \left (c+d x+\frac {\pi }{2}\right )\right )dx\) |
\(\Big \downarrow \) 3232 |
\(\displaystyle \frac {1}{3} \int (a+b \cos (c+d x)) (3 a B+2 b C+(3 b B+2 a C) \cos (c+d x))dx+\frac {C \sin (c+d x) (a+b \cos (c+d x))^2}{3 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {1}{3} \int \left (a+b \sin \left (c+d x+\frac {\pi }{2}\right )\right ) \left (3 a B+2 b C+(3 b B+2 a C) \sin \left (c+d x+\frac {\pi }{2}\right )\right )dx+\frac {C \sin (c+d x) (a+b \cos (c+d x))^2}{3 d}\) |
\(\Big \downarrow \) 3213 |
\(\displaystyle \frac {1}{3} \left (\frac {2 \left (a^2 C+3 a b B+b^2 C\right ) \sin (c+d x)}{d}+\frac {3}{2} x \left (2 a^2 B+2 a b C+b^2 B\right )+\frac {b (2 a C+3 b B) \sin (c+d x) \cos (c+d x)}{2 d}\right )+\frac {C \sin (c+d x) (a+b \cos (c+d x))^2}{3 d}\) |
(C*(a + b*Cos[c + d*x])^2*Sin[c + d*x])/(3*d) + ((3*(2*a^2*B + b^2*B + 2*a *b*C)*x)/2 + (2*(3*a*b*B + a^2*C + b^2*C)*Sin[c + d*x])/d + (b*(3*b*B + 2* a*C)*Cos[c + d*x]*Sin[c + d*x])/(2*d))/3
3.8.80.3.1 Defintions of rubi rules used
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.) *(x_)]), x_Symbol] :> Simp[(2*a*c + b*d)*(x/2), x] + (-Simp[(b*c + a*d)*(Co s[e + f*x]/f), x] - Simp[b*d*Cos[e + f*x]*(Sin[e + f*x]/(2*f)), x]) /; Free Q[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-d)*Cos[e + f*x]*((a + b*Sin[e + f*x])^m/( f*(m + 1))), x] + Simp[1/(m + 1) Int[(a + b*Sin[e + f*x])^(m - 1)*Simp[b* d*m + a*c*(m + 1) + (a*d*m + b*c*(m + 1))*Sin[e + f*x], x], x], x] /; FreeQ [{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] && GtQ[m, 0] && IntegerQ[2*m]
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.)*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_ .) + (f_.)*(x_)]^2), x_Symbol] :> Simp[1/b^2 Int[(a + b*Sin[e + f*x])^(m + 1)*(c + d*Sin[e + f*x])^n*(b*B - a*C + b*C*Sin[e + f*x]), x], x] /; FreeQ [{a, b, c, d, e, f, A, B, C, m, n}, x] && NeQ[b*c - a*d, 0] && EqQ[A*b^2 - a*b*B + a^2*C, 0]
Time = 1.55 (sec) , antiderivative size = 88, normalized size of antiderivative = 0.82
method | result | size |
parallelrisch | \(\frac {\left (3 B \,b^{2}+6 C a b \right ) \sin \left (2 d x +2 c \right )+C \sin \left (3 d x +3 c \right ) b^{2}+\left (24 B a b +12 a^{2} C +9 b^{2} C \right ) \sin \left (d x +c \right )+12 x \left (B \,a^{2}+\frac {1}{2} B \,b^{2}+C a b \right ) d}{12 d}\) | \(88\) |
parts | \(\frac {\left (B \,b^{2}+2 C a b \right ) \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {\left (2 B a b +a^{2} C \right ) \sin \left (d x +c \right )}{d}+\frac {B \,a^{2} \left (d x +c \right )}{d}+\frac {b^{2} C \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3 d}\) | \(98\) |
derivativedivides | \(\frac {\frac {b^{2} C \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+B \,b^{2} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+2 C a b \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+2 B \sin \left (d x +c \right ) a b +a^{2} C \sin \left (d x +c \right )+B \,a^{2} \left (d x +c \right )}{d}\) | \(114\) |
default | \(\frac {\frac {b^{2} C \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+B \,b^{2} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+2 C a b \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+2 B \sin \left (d x +c \right ) a b +a^{2} C \sin \left (d x +c \right )+B \,a^{2} \left (d x +c \right )}{d}\) | \(114\) |
risch | \(a^{2} B x +\frac {b^{2} B x}{2}+a b C x +\frac {2 \sin \left (d x +c \right ) B a b}{d}+\frac {\sin \left (d x +c \right ) a^{2} C}{d}+\frac {3 b^{2} C \sin \left (d x +c \right )}{4 d}+\frac {\sin \left (3 d x +3 c \right ) b^{2} C}{12 d}+\frac {\sin \left (2 d x +2 c \right ) B \,b^{2}}{4 d}+\frac {\sin \left (2 d x +2 c \right ) C a b}{2 d}\) | \(116\) |
norman | \(\frac {\left (B \,a^{2}+\frac {1}{2} B \,b^{2}+C a b \right ) x +\left (B \,a^{2}+\frac {1}{2} B \,b^{2}+C a b \right ) x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (4 B \,a^{2}+2 B \,b^{2}+4 C a b \right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (4 B \,a^{2}+2 B \,b^{2}+4 C a b \right ) x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (6 B \,a^{2}+3 B \,b^{2}+6 C a b \right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {\left (4 B a b -B \,b^{2}+2 a^{2} C -2 C a b +2 b^{2} C \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {\left (4 B a b +B \,b^{2}+2 a^{2} C +2 C a b +2 b^{2} C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {\left (36 B a b -3 B \,b^{2}+18 a^{2} C -6 C a b +10 b^{2} C \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}+\frac {\left (36 B a b +3 B \,b^{2}+18 a^{2} C +6 C a b +10 b^{2} C \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{4}}\) | \(333\) |
1/12*((3*B*b^2+6*C*a*b)*sin(2*d*x+2*c)+C*sin(3*d*x+3*c)*b^2+(24*B*a*b+12*C *a^2+9*C*b^2)*sin(d*x+c)+12*x*(B*a^2+1/2*B*b^2+C*a*b)*d)/d
Time = 0.27 (sec) , antiderivative size = 85, normalized size of antiderivative = 0.79 \[ \int (a+b \cos (c+d x))^2 \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\frac {3 \, {\left (2 \, B a^{2} + 2 \, C a b + B b^{2}\right )} d x + {\left (2 \, C b^{2} \cos \left (d x + c\right )^{2} + 6 \, C a^{2} + 12 \, B a b + 4 \, C b^{2} + 3 \, {\left (2 \, C a b + B b^{2}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{6 \, d} \]
1/6*(3*(2*B*a^2 + 2*C*a*b + B*b^2)*d*x + (2*C*b^2*cos(d*x + c)^2 + 6*C*a^2 + 12*B*a*b + 4*C*b^2 + 3*(2*C*a*b + B*b^2)*cos(d*x + c))*sin(d*x + c))/d
\[ \int (a+b \cos (c+d x))^2 \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\int \left (B + C \cos {\left (c + d x \right )}\right ) \left (a + b \cos {\left (c + d x \right )}\right )^{2} \cos {\left (c + d x \right )} \sec {\left (c + d x \right )}\, dx \]
Time = 0.21 (sec) , antiderivative size = 108, normalized size of antiderivative = 1.01 \[ \int (a+b \cos (c+d x))^2 \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\frac {12 \, {\left (d x + c\right )} B a^{2} + 6 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} C a b + 3 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} B b^{2} - 4 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} C b^{2} + 12 \, C a^{2} \sin \left (d x + c\right ) + 24 \, B a b \sin \left (d x + c\right )}{12 \, d} \]
1/12*(12*(d*x + c)*B*a^2 + 6*(2*d*x + 2*c + sin(2*d*x + 2*c))*C*a*b + 3*(2 *d*x + 2*c + sin(2*d*x + 2*c))*B*b^2 - 4*(sin(d*x + c)^3 - 3*sin(d*x + c)) *C*b^2 + 12*C*a^2*sin(d*x + c) + 24*B*a*b*sin(d*x + c))/d
Leaf count of result is larger than twice the leaf count of optimal. 254 vs. \(2 (99) = 198\).
Time = 0.33 (sec) , antiderivative size = 254, normalized size of antiderivative = 2.37 \[ \int (a+b \cos (c+d x))^2 \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\frac {3 \, {\left (2 \, B a^{2} + 2 \, C a b + B b^{2}\right )} {\left (d x + c\right )} + \frac {2 \, {\left (6 \, C a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 12 \, B a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 6 \, C a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 3 \, B b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 6 \, C b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 12 \, C a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 24 \, B a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 4 \, C b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 6 \, C a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 12 \, B a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 6 \, C a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, B b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 6 \, C b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{3}}}{6 \, d} \]
1/6*(3*(2*B*a^2 + 2*C*a*b + B*b^2)*(d*x + c) + 2*(6*C*a^2*tan(1/2*d*x + 1/ 2*c)^5 + 12*B*a*b*tan(1/2*d*x + 1/2*c)^5 - 6*C*a*b*tan(1/2*d*x + 1/2*c)^5 - 3*B*b^2*tan(1/2*d*x + 1/2*c)^5 + 6*C*b^2*tan(1/2*d*x + 1/2*c)^5 + 12*C*a ^2*tan(1/2*d*x + 1/2*c)^3 + 24*B*a*b*tan(1/2*d*x + 1/2*c)^3 + 4*C*b^2*tan( 1/2*d*x + 1/2*c)^3 + 6*C*a^2*tan(1/2*d*x + 1/2*c) + 12*B*a*b*tan(1/2*d*x + 1/2*c) + 6*C*a*b*tan(1/2*d*x + 1/2*c) + 3*B*b^2*tan(1/2*d*x + 1/2*c) + 6* C*b^2*tan(1/2*d*x + 1/2*c))/(tan(1/2*d*x + 1/2*c)^2 + 1)^3)/d
Time = 1.87 (sec) , antiderivative size = 115, normalized size of antiderivative = 1.07 \[ \int (a+b \cos (c+d x))^2 \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=B\,a^2\,x+\frac {B\,b^2\,x}{2}+\frac {C\,a^2\,\sin \left (c+d\,x\right )}{d}+\frac {3\,C\,b^2\,\sin \left (c+d\,x\right )}{4\,d}+C\,a\,b\,x+\frac {B\,b^2\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}+\frac {C\,b^2\,\sin \left (3\,c+3\,d\,x\right )}{12\,d}+\frac {2\,B\,a\,b\,\sin \left (c+d\,x\right )}{d}+\frac {C\,a\,b\,\sin \left (2\,c+2\,d\,x\right )}{2\,d} \]